<%= settings_layout do %>
  <%= content_for :title, "Team Members" %>
  <%= turbo_stream_from [:teams, current_account] %>

  <div>
    <div>
      <h2 class="text-2xl font-bold">Team Members</h2>
      <div class="flex text-sm">
        <div class="flex items-center gap-1">
          <iconify-icon icon="lucide:building"></iconify-icon>
          <%= current_account.name %>
        </div>
        <div class="flex items-center ml-4 gap-1">
          <iconify-icon icon="lucide:users"></iconify-icon>
          <%= current_account.users.count %> Member<%= "s" if current_account.users.count != 1 %>
        </div>
        <div class="flex items-center ml-4 gap-1">
          <iconify-icon icon="lucide:shield"></iconify-icon>
          <%= current_account.teams.count %> Team<%= "s" if current_account.teams.count != 1 %>
        </div>
      </div>
    </div>

    <!-- Tabs -->
    <div role="tablist" class="tabs tabs-bordered mt-5">
      <%= link_to account_users_path, role: "tab", class: "tab" do %>
        Members
      <% end %>
      <%= link_to teams_path, role: "tab", class: "tab tab-active" do %>
        Teams
      <% end %>
    </div>

    <div class="mt-5">
      <%= tag.div id: "teams" do %>
        <%= render "accounts/teams/list", teams: @teams %>
      <% end %>
    </div>
  </div>
<% end %>
